package com.wq.httpclientcore.entities.req.save;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.time.LocalDateTime;

@Data
@Schema(name = "ApiConfigSaveREQ", description = "API 配置保存请求信息")
public class ApiConfigSaveREQ {
    @Schema(description = "API 配置的唯一标识", example = "1")
    private Long id;
    @Schema(description = "API 配置的名称", example = "用户信息查询 API")
    private String name;
    @Schema(description = "API 的基础 URL", example = "https://api.example.com")
    private String baseUrl;
    @Schema(description = "API 的路径", example = "/users")
    private String path;
    @Schema(description = "API 的请求方法", example = "GET")
    private String method;
    @Schema(description = "API 的请求头，JSON 字符串格式", example = "{\"Content-Type\": \"application/json\"}")
    private String requestHeaders;
    @Schema(description = "API 的请求体，JSON 字符串格式", example = "{\"key\": \"value\"}")
    private String requestBody;
    @Schema(description = "API 的响应类型", example = "JSON")
    private String responseType;
    @Schema(description = "API 的请求参数，JSON 字符串格式", example = "{\"param1\": \"value1\", \"param2\": \"value2\"}")
    private String requestParams;
    @Schema(description = "关联的鉴权配置 ID", example = "1")
    private Long authConfigId;
    @Schema(description = "API 是否启用", example = "true")
    private Boolean enabled;
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8", shape = JsonFormat.Shape.STRING)
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @Schema(description = "API 配置的创建时间", example = "2025-03-10 15:41:09")
    private LocalDateTime createdAt;
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8", shape = JsonFormat.Shape.STRING)
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @Schema(description = "API 配置的更新时间", example = "2025-03-10 15:41:09")
    private LocalDateTime updatedAt;
}